import { Container } from 'inversify';
import React from 'react';

export type EditorMode = '2d' | 'interactive' | 'preview';

export interface EditorState {
    mode: EditorMode;
    // 可以添加更多状态
}

export interface ToolbarItem {
    id: string;
    label: string;
    icon?: string;
    action: () => void;
}

export interface PanelItem {
    id: string;
    title: string;
    content: React.ReactNode;
}

// 模式功能接口
export interface ModeFeature {
    toolbarItems: ToolbarItem[];
    leftPanelItems: PanelItem[];
    rightPanelItems: PanelItem[];
    view: React.ReactNode;
    message: string;
}

// 模式注册器接口
export interface IModeRegistry {
    registerMode(mode: EditorMode, feature: ModeFeature): void;
    unregisterMode(mode: EditorMode): void;
    getModeFeature(mode: EditorMode): ModeFeature | undefined;
    getAvailableModes(): EditorMode[];
}

// 配置接口
export interface ToolbarConfig {
    [key: string]: {
        items: ToolbarItem[];
    };
}

export interface PanelConfig {
    [key: string]: {
        left: PanelItem[];
        right: PanelItem[];
    };
}

export interface ViewConfig {
    [key: string]: {
        render: () => React.ReactNode;
    };
}

export interface MessageConfig {
    [key: string]: {
        getMessage: () => string;
    };
}

// 服务接口定义
export interface IEditorService {
    getMode(): EditorMode;
    setMode(mode: EditorMode): void;
    getState(): EditorState;
    subscribe(listener: (state: EditorState) => void): () => void;
}

export interface IToolbarService {
    getToolbarItems(mode: EditorMode): ToolbarItem[];
}

export interface IPanelService {
    getLeftPanelItems(mode: EditorMode): PanelItem[];
    getRightPanelItems(mode: EditorMode): PanelItem[];
}

export interface IViewService {
    renderView(mode: EditorMode): React.ReactNode;
}

export interface IMessageService {
    getMessage(mode: EditorMode): string;
}

// 依赖注入容器
export const container = new Container(); 